# Contributor: Aaron Hurt <ahurt@ena.com>
# Maintainer: Aaron Hurt <ahurt@ena.com>
pkgname=pacparser
pkgver=1.3.7
pkgrel=2
pkgdesc="A library to parse proxy auto-config (PAC) files"
url="http://pacparser.manugarg.com"
# x86, armhf: https://github.com/pacparser/pacparser/issues/77
arch="x86_64"
license="LGPL-3.0-or-later"
makedepends="bash python3-dev"
subpackages="py3-$pkgname:pymod $pkgname-doc $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/pacparser/pacparser/archive/$pkgver.tar.gz
	spidermonkey-make.patch"

prepare() {
	find "$builddir" -name \*.git\* -delete
	default_prepare
}

build() {
	# There's some concurrency problem, so we must disable parallel build.
	# https://github.com/pacparser/pacparser/issues/27
	PYTHON=python3 make -j1 -C src pactester pymod
}

package() {
	make -C src DESTDIR="$pkgdir" install
}

pymod() {
	depends="python3"
	replaces="py-pymod" # Backwards compatibility
	provides="py-pymod=$pkgver-r$pkgrel" # Backwards compatibility

	cd "$builddir"
	PYTHON=python3 make -C src DESTDIR="$subpkgdir" install-pymod
}

sha512sums="9722dbfb0935824c5bea5f092e7bf82b74a0e59387e2a887d1c4e9234bcdb0af3ba4b58d5041dc6192e10200e46746481568a36bcdeca4860cdf00a921adfd2d  pacparser-1.3.7.tar.gz
6f584acfb1f9f16385bef277f4c6bd30fa5f1e77d137cdd3306d50ce60e4917da34d47cd943ea078a264298dfa4a8c3256b447072dd108349e8deddfa536a60d  spidermonkey-make.patch"
